package main

import (
	"fmt"
	"time"
	"os"
	"os/exec"
)

func clearScreen() {
	cmd := exec.Command("clear") // Linux 和 macOS 使用 "clear"
	if _, err := cmd.Output(); err != nil {
		cmd = exec.Command("cls") // Windows 使用 "cls"
	}
	cmd.Stdout = os.Stdout
	cmd.Run()
}

func main() {
	// 定义恐龙跑动和跳跃的帧
	runningFrames := []string{
"____________________________________________________________________________\n" +
"                                                                            \n" +
"                   _..-'(                       )`-.._                      \n" +
"                 ./'. '||\\\\.       (\\_/)       .//||` .`.                  \n" +
"              ./'.|'.'||||\\\\|..    )O O(    ..|//||||`.`|.`.               \n" +
"           ./'..|'.|| |||||\\`````` '`\"'` ''''''/||||| ||.`|..`.           \n" +
"         ./'.||'.|||| ||||||||||||.     .|||||||||||| |||||.`||.`.         \n" +
"        /'|||'.|||||| ||||||||||||{     }|||||||||||| ||||||.`|||`\\        \n" +
"       '.|||'.||||||| ||||||||||||{     }|||||||||||| |||||||.`|||.`       \n" +
"      '.||| ||||||||| |/'   ``\\||``     ''||/''   `\\| ||||||||| |||.`      \n" +
"      |/' \\./'     `\\./         \\!|\\   /|!/         \\./'     `\\./ `\\|      \n" +
"      V    V         V          }' `\\ /' `{          V         V    V      \n" +
"      `    `         `               V               '         '    '      \n" +
"____________________________________________________________________________\n",

`
                          []                         []                        
                          ||   ___     ___     ___   ||                        
                          ||  /   \   /| |\   /   \  ||                        
                          || |  O  |__|| ||__|  O  | ||                        
                          ||  \___/--/^^^^^\--\___/  ||                        
                      __  ||________|       |________||  __                    
   .-----------------/  \-++--------|   .   |--------++-/  \-----------------. 
  /.---------________|  |___________\__(*)__/___________|  |________---------.\
            |    |   '$$'   |                       |   '$$'   |    |          
           (o)  (o)        (o)                     (o)        (o)  (o)         
                                                                               
                                                                               
 ____________________________________________________________________________`,
	}

	jumpingFrames := []string{
		`
          __
        _/  \__
       /       o
      /    --   \     __
     /          \    / o\__
    /|    __    |\  /      o
__/  |__________|_/___________\
       O   O
    O        O`,
	}

	// 循环跑动动画
	for i := 0; i < 10; i++ {
		for _, frame := range runningFrames {
			clearScreen()
			fmt.Println(frame)
			time.Sleep(300 * time.Millisecond)
		}

		// 每5次跑动后跳跃一次
		if i%5 == 4 {
			for _, frame := range jumpingFrames {
				clearScreen()
				fmt.Println(frame)
				time.Sleep(300 * time.Millisecond)
			}
		}
	}
}
